import { ref, h } from "vue";
import TagStatus from "@/components/TagStatus/index.vue";
import LinkText from "@/components/LinkText/index.vue";
import platform from "../common/platformType.vue";
import { render } from "@/utils";

export const columns = [
 
  {
    title: "集群名称",
    dataIndex: "name",
    tooltip: true,
    ellipsis: true,
    width: 200,
    render: ({ record }) =>
      h(LinkText, {
        label: record?.name,
        to: `/mgmt/cluster-list/detail/${record?.id}?name=${record?.name}&resId=${record?.resourceId}&type=${record?.resourceType}&uuid=${record?.uuid}&menu=cluster`,
      }),
  },
  {
    title: "业务模型",
    dataIndex: "bizModel",
    tooltip: true,
    ellipsis: true,
    width: 220,
    render: ({ record }) =>h(LinkText, { label: record?.zoneName, desc:Array.isArray(record.modelList) ? record.modelList.join('/') : record.modelList}),
  },
 {
    title: "资源类型",
    dataIndex: "resourceType",
    slotName: "resourceType",
    // width: 100,
     render: ({ record }) => h(platform, { type: record?.resourceType }),
  },
  {
    title: "状态",
    dataIndex: "status",
    // width: 90,
    render: ({ record }) => h(TagStatus, { type: record.status }),
  },
  {
    title: '启用',
    dataIndex: 'enabled',
    slotName: 'enabled',
    // width: 80,
  },
  {
    title: 'CMDB同步',
    dataIndex: 'isShared',
    slotName: 'isShared',
    // width: 80,
  },
  {
    title: '关联项目数',
    dataIndex: 'projectNum',
    render,
  },
  {
    title: "操作",
    width: 160,
    dataIndex: "action",
    fixed: "right",
    slotName: "action",
  }
]
